package scsc.pm;


import java.util.*;


import scsc.pub.db.*;
import scsc.pub.tools.*;
import java.util.ArrayList;
import scsc.web.xzgl.building.report.data.RoomRentReportData;
import scsc.pub.exception.*;

public class RoomRentReportPm {
  private static Logger logger = Logger.getLogger(RoomRentReportPm.class);
  public RoomRentReportPm() {
  }

  public void selectRoomRentReport(DBManage dbmanage, RoomRentReportData formdata,
                                  PageListData footer) {
	 String selBeginDate=formdata.getBeginDate();
	 String selEndDate=formdata.getEndDate();
	 Integer selBuildId=formdata.getBuildId();
	 Long selRoomId=formdata.getRoomId();
	 String selRenterName=formdata.getRenterName();
	 
	 
	String sqlStr="select new scsc.web.xzgl.building.report.data.RoomRentReportData(";
	sqlStr+="rtr.renterName,rtr.roomId,r.roomAddress,h.buildName,r.unit,r.room,r.insideArea,rtr.balconyUseArea,rtr.executeUnitPrice,";
	sqlStr+="rtr.outRent,rtr.outControlRent,rtr.newRent,rtr.outAddRent,rtr.factRent";
	sqlStr+=")";
	sqlStr+=" from scsc.pub.data.RoomTotalRent as rtr,scsc.pub.data.RoomMng as r,scsc.pub.data.HouseBuilding as h where rtr.roomId=r.roomId and r.builderId=h.buildId";

	//if (selBeginDate!=null && selBeginDate.length()>0)
	//	sqlStr+=" and r.beginDate>='" + selBeginDate + "'";
	//if (selEndDate!=null && selEndDate.length()>0)
	//	sqlStr+=" and r.endDate<='" + selEndDate + "'";
	if (selBuildId!=null && selBuildId.intValue()!=0)
		sqlStr+=" and h.buildId=" + selBuildId;
	if (selRoomId!=null && selRoomId.intValue()!=0)
		sqlStr+=" and rtr.roomId=" + selRoomId;
	if (selRenterName!=null && selRenterName.trim().length()>0)
		sqlStr+=" and rtr.renterName like '%" + selRenterName + "%'";
	sqlStr+=" order by rtr.rentId";
	//sqlStr+=" group by h.roomId,h.room,h.roomPlace,h.tenancyUnit,h.corporation,h.tel";
	dbmanage.sqlQueryPage(sqlStr, footer);

  }

//  public void selectBusinessDetailReport(DBManage dbmanage, BusinessReportData formdata,
//          PageListData footer){
//	  String selBeginDate=formdata.getSelStartDate();
//	  String selEndDate=formdata.getSelEndDate();
//	  String selUnit=formdata.getTenancyUnit();
//	  String sqlStr="select new scsc.web.xzgl.building.report.data.BusinessReportData(";
//	  sqlStr+="h.roomId,h.room,h.roomPlace,h.tenancyUnit,h.corporation,r.beginDate,r.endDate,r.rentFeeStd,r.rentFee,r.waterFee,r.elecFee,r.warmFee,h.tel";
//	  sqlStr+=")";
//	  sqlStr+=" from scsc.pub.data.BusinessHouse as h,scsc.pub.data.BusinessHouseRentFee as r where r.roomId=h.roomId";
//		if (selUnit!=null && selUnit.length()>0)
//			sqlStr+=" and h.tenancyUnit like '%" + selUnit + "%'";
//		if (selBeginDate!=null && selBeginDate.length()>0)
//			sqlStr+=" and r.beginDate>='" + selBeginDate + "'";
//		if (selEndDate!=null && selEndDate.length()>0)
//			sqlStr+=" and r.endDate<='" + selEndDate + "'";
//		sqlStr+=" order by h.roomId";
//		dbmanage.sqlQueryPage(sqlStr, footer);
//	  
//  }

  
}
